package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.system.ITripRole;
import com.gec.model.system.ITripRoomType;
import com.gec.model.vo.ITripRoomTypeVo;
import com.gec.system.mapper.ITripRoomTypeMapper;
import com.gec.system.service.ITripRoomTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dafei
 * @since 2024-01-24
 */
@Service
public class ITripRoomTypeServiceImpl extends ServiceImpl<ITripRoomTypeMapper, ITripRoomType> implements ITripRoomTypeService {

    @Override
    public IPage<ITripRoomType> selectPage(IPage<ITripRoomType> page1, ITripRoomTypeVo iTripRoomTypeVo) {
        IPage<ITripRoomType> iPage = this.baseMapper.selectPage(page1,iTripRoomTypeVo,null);
        return iPage;
    }

    @Override
    public ITripRoomType selectByName(String roomType) {

        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("roomType",roomType);//相当于where typeNo=1
        List<ITripRoomType> list = baseMapper.selectList(wrapper);
        return list.size()==0 ?null :list.get(0);
    }
}
